package com.xz.group12306.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.xz.group12306.business.service.ManagerService;
import com.xz.group12306.business.service.impl.ManagerServiceImpl;
import com.xz.group12306.domain.User;

/**
 * 管理员删除用户记录Servlet
 * 顾赛男
 */
@WebServlet("/ManageDelUserServlet")
public class ManageDelUserServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * 构造方法
     */
    public ManageDelUserServlet() {
        super();
    }

	/**
	 * doGet方法
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
//		int pageSize = Integer.parseInt(request.getParameter("pageSize"));
//		int start = Integer.parseInt(request.getParameter("start"));
		
		String UserID=request.getParameter("id");
		ManagerService managerService=new ManagerServiceImpl();
		managerService.delUser(Integer.parseInt(UserID));
		
		List<User> users = managerService.findAllList();
		HttpSession session = request.getSession();

		session.setAttribute("users", users);
		response.sendRedirect("admin/DeleteUpdate.jsp");
		
		
	}

	/**
	 * doPost方法
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
